<?php

namespace App\Http\Controllers\user;

use App\Dao\OrdersDao;
use App\Exceptions\SysExceptions;
use App\Services\Code;

class OrdersController extends BaseController
{
    public function orders(): array
    {
        $params = request()->all();
        $params['user_id'] = getUserToken();
        $orders = OrdersDao::orders($params);
        return Code::message('',200,$orders);
    }

    /**
     * @throws SysExceptions
     */
    public function order_create(): array
    {
        $params = request()->all();
        $params['user_id'] = getUserToken();
        return Code::message('购买成功',200,OrdersDao::orders_create($params));
    }


    public function update_user_info()
    {
        $params=  request()->all();
        OrdersDao::userUploadInfo($params);
        return Code::message('',200);
    }


    public function orders_info(): array
    {
        $params = request()->all();
        $info = OrdersDao::orders_info($params);
        return Code::message('',200,$info);
    }

    //扫码绑定确认收货
    public function order_scan_code_confirm(): array
    {
        $params = request()->all();

        OrdersDao::confirm($params);
        return Code::message('',200);
    }


}
